<?php
namespace app\admin\model;
use think\Model;

class Admin extends Model{
	//protected $table = 'lot_admin';
	protected $autoWriteTimestamp =true;
	public  function addUser(){
		$user = new Login;
		$data['uname'] = 'yqq';
		$data['pwd'] = md5(123);
		$user->data = $data;
		if($user->save()){
			return true;
		}else{
			return false;
		}
	}
	public function add($data){
		//过滤data数组中非数据表中的数据
		return $this->allowField(true)->save($data);
	}
	public function getUser($data){
		return $this->where($data)->find();
	}
    
    public function getRidAttr($val){
    	return model('role')->where("id = $val")->value('name');
    }

}